package com.lin;

import java.io.IOException;
import java.util.HashSet;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.Set;

public class test {
    public static void main(String[] args) {
        try {
            readFile(".tx");
        }catch (IOException e){
            System.out.println(e);
            System.out.println(e.toString());
            e.printStackTrace();
        }
    }

    public static void show01(){
        LinkedList<String> linked = new LinkedList<>();
        linked.add("a");
        linked.add("a");
        linked.add("a");
        System.out.println(linked);

        linked.clear();

        if(linked.isEmpty()){
            linked.addFirst("www");
            linked.addLast(".com");

            System.out.println(linked);
        }
    }

    public static void show02(){
        HashSet<Integer> set = new HashSet<>();
        set.add(1);
        set.add(2);
        System.out.println(set);
        for (Integer integer : set) {
            System.out.println(integer);
        }
        Iterator<Integer> it = set.iterator();
        while (it.hasNext()){
            Integer n = it.next();
            System.out.println(n);
        }
    }

    public static void readFile(String fileName) throws IOException {
        if(!fileName.endsWith(".txt")){
            throw new IOException("文件类型错误");
        }
        System.out.println("文件类型错误");
    }
}
